package service;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;

import controller.Archive;
import pojo.User;
import dao.ArchiveDao;
import util.MybatisSessionFactory;

public class ArchiveService {
	SqlSession Session = MybatisSessionFactory.getSqlSession();
	ArchiveDao dao = Session.getMapper(ArchiveDao.class);
	public void add(
			 String archive_id,
			 String identity,
			 String name,
			 String gender,
			 String birthday,
			 String date_retire1,
			 String date_retire2,
			 String sp,
			 String fc,
			 String title,
			 String seniority){
	dao.add(archive_id, identity, name, gender, birthday, date_retire1, date_retire2, sp, fc, title, seniority);	 
	Session.commit();
	}
	public pojo.Archive queryone(String archive_id,String identity) {
		Session.commit();
		return dao.queryone(archive_id, identity);}
    public Map<String, Object> LastId(){
    	Map<String, Object> map=new HashMap<String, Object>();
	   map=dao.LastId();
    	 return map;}
    public List<Map<String, Object>>  chaxun(
			 String archive_id,
			 String identity,
			 String name,
			 String gender,
			 String birthday,
			 String date_retire1,
			 String date_retire2,
			 String sp,
			 String fc,
			 String title,
			 String seniority){
    	List<Map<String, Object>> arc=dao.chaxun(archive_id, identity, name, gender, birthday, date_retire1, date_retire2, sp, fc, title, seniority);	 
	Session.commit();
	return arc;
	}
    public pojo.Archive  chaxun2(String a){
    	Session.commit();
				return dao.chaxun2(a);}
    public List<Map<String,Object>>   chaxun3(String id){
    	Session.commit();
				return dao.chaxun3(id);}
	
    public void update(
    		 String id,
			 String archive_id,
			 String identity,
			 String name,
			 String gender,
			 String birthday,
			 String date_retire1,
			 String date_retire2,
			 String sp,
			 String fc,
			 String title,
			 String seniority){
	dao.update(id,archive_id, identity, name, gender, birthday, date_retire1, date_retire2, sp, fc, title, seniority);	 
	Session.commit();
	}
    public Map<String,Object> querynickname(String id){
    	Session.commit();
    	return  dao.querynickname(id);
    }
    public Map<String,Object> info(String id){
    	Session.commit();
    	return  dao.info(id);
    }
     public void insertPages(String archive_id,String name){
    	 dao.insertPages(archive_id, name);
    	 Session.commit();
    	 
     }
     public List<Map<String, Object>> queryfile(String id){
     	Session.commit();
     	return  dao.queryfile(id);
     }
	public List<Map<String, Object>> querytu(String id) {
		Session.commit();
		return dao.querytu(id);
	}
	public void del(String id) {
		
		dao.del(id);
		Session.commit();
		//System.out.println(id);
		
	}
	public Map<String,Object> info2(String id){
    	Session.commit();
    	return  dao.info2(id);
    }
	public List<Map<String, Object>> tongji() {
		//Session.commit();
		return dao.tongji();
	}
	public List<Map<String, Object>> record(String id){
    	Session.commit();
    	return  dao.record(id);}
	public List<Map<String, Object>> tianjia(String id) {
		Session.commit();
    	return  dao.tianjia(id);
	}
	public Map<String, Object> queryaccount(String id){
    	Session.commit();
    	return  dao.queryaccount(id);
    }
	public List<Map<String, Object>> chadate(String date1,String date2){
    	Session.commit();
    	return  dao.chadate(date1,date2);}
}

